<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="../node_modules/vue/dist/vue.js"></script>
<body>
    <div id="app">
        <li v-for="(item, index) in userList" :key="index">
            {{item.name}}---{{item.gender==1?"男":"女"}} ---{{item.gender | genderFilter}}
        </li>
    </div>
</body>
<script>
    new Vue({
        el:"#app",
        data:{
            userList: [
                    { id: 1, name: 'jacky', gender: 1 },
                    { id: 2, name: 'peter', gender: 0 }
                ]
        },
        methods:{
            
        },
        computed:{
            
        },
        watch:{
            
        },
        filters:{
            genderFilter(val){
                if(val == "1"){
                    return "男"
                }else{
                    return "女"
                }
            }
        }
    })
</script>
</html>